﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Data;
using System.Data.SqlClient;
namespace LicPdaService
{
    public class PDAXmlAllocationReceipt
    {
        /// <summary>
        /// 11.0调拨单（扫描调拨单号、检验是否存在系统,返回信息）
        /// DataSource:Orders
        /// </summary>
        public static string GetAllocationKey(string xml)
        {
            List<string> sqllists = new List<string>();
            string strSql = string.Empty;
            App.Connection();
            App.DBconSet();

            //1接收调拨单XML(判断是否存在该笔调拨单)

            //  DataTable ldt = LicPdaService.App.Xml3DataTable(xml);
            DataTable ldt = LicPdaService.App.Xml2DataTable(xml);//取调拨单号
            if (ldt.Rows.Count == 0)
            {
                return "";
            }

            //DataTable ldt = LicPdaService.App.Xml3DataTable(xml);//取调拨单号
            //if (ldt.Rows.Count == 0)
            //{
            //    return "";
            //}
            try
            {

                strSql = "select  * from InvAllocation  where 1=1  and whseid='" + ldt.Rows[0]["whseid"].ToString() + "'     and allocationkey='" + ldt.Rows[0]["allocationkey"].ToString() + "'  ";
                strSql += " and status='0' ";
                DataTable dtAlt = App.GetDataTable(App.DBconWMS, strSql, "InvAllocation");//调拨单信息
                return Allocation_Return(dtAlt);
            }
            catch (Exception ex)
            {
                #region
                App.Log("PDAXmlAllocationReceipt.cs-11.0", ex.Message.ToString());
                throw;
                #endregion
            }
        }

        //  调拨单--是否存在系统中
        private static string Allocation_Return(DataTable ldt)
        {
            XmlDocument doc = new XmlDocument();//返回报文
            try
            {
               // string return_status = "";
                XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);
                doc.AppendChild(dec);
                XmlElement rootRet = doc.CreateElement("NewDataSet");
                if (ldt.Rows.Count != 0)
                {
                    for (int i = 0; i < ldt.Rows.Count; i++)
                    {
                        XmlNode putawayNodes = doc.CreateElement("Allocation_return");//返回用户节点
                        XmlElement lxMessageType = doc.CreateElement("MessageType");
                        XmlElement lxereturn_status = doc.CreateElement("return_status");
                        lxMessageType.InnerText = "AllocationKey";
                        lxereturn_status.InnerText = "OK";
                        putawayNodes.AppendChild(lxMessageType);
                        putawayNodes.AppendChild(lxereturn_status);
                        rootRet.AppendChild(putawayNodes);
                    }
                }
                else
                {
                    XmlNode putawayNodes = doc.CreateElement("Allocation_return");//返回用户节点
                    XmlElement lxMessageType = doc.CreateElement("MessageType");
                    XmlElement lxereturn_status = doc.CreateElement("return_status");
                    lxMessageType.InnerText = "AllocationKey";
                    lxereturn_status.InnerText = "扫描的调拨单不存在,请查看厂别是否正确";
                    putawayNodes.AppendChild(lxMessageType);
                    putawayNodes.AppendChild(lxereturn_status);
                    rootRet.AppendChild(putawayNodes);

                }
                doc.AppendChild(rootRet);
                return doc.InnerXml;
            }
            catch (Exception ex)
            {
                App.Log("PDAXmlAllocationReceipt.cs-11.1", ex.Message.ToString());
                return doc.InnerXml;
            }

        }


        //11.1根据调拨单号、托盘号查询调拨信息
        public static string GetAllocationDetail(string xml)
        {
            List<string> sqllists = new List<string>();
            string strSql = string.Empty;
            App.Connection();
            App.DBconSet();

            //1接收调拨单XML(根据调拨单、托盘号查询调拨信息)

           // DataTable ldt = LicPdaService.App.Xml3DataTable(xml);
            DataTable ldt = LicPdaService.App.Xml2DataTable(xml);//取调拨单号、
            if (ldt.Rows.Count == 0)
            {
                return "";
            }

            //DataTable ldt = LicPdaService.App.Xml3DataTable(xml);//根据调拨单号、托盘号查询调拨信息
            //if (ldt.Rows.Count == 0)
            //{
            //    return "";
            //}
            try
            {

                strSql = "select  * from InvAllocationdetail  where 1=1  and whseid='" + ldt.Rows[0]["whseid"].ToString() + "' and    allocationkey='" + ldt.Rows[0]["allocationkey"].ToString() + "'  ";
                strSql += " and status='0'  and traykey = '" + ldt.Rows[0]["traykey"].ToString() + "'  ";
               // and traykey = '" + ldt.Rows[0]["traykey"].ToString() + "'
                DataTable dtAlt = App.GetDataTable(App.DBconWMS, strSql, "InvAllocationdetail");//调拨单信息
                if (dtAlt.Rows.Count == 0)
                {
                    DataTable dts = new DataTable();
                    return AllocationDetail_Return(dts);
                }
                else
                {
                    return AllocationDetail_Return(dtAlt);
                }
          
                
            }
            catch (Exception ex)
            {
                #region
                App.Log("PDAXmlAllocationReceipt.cs-11.1", ex.Message.ToString());
                throw;
                #endregion
            }
        }


        //根据调拨单--托盘号、获取调拨信息
        private static string AllocationDetail_Return(DataTable ldt)
        {
            XmlDocument doc = new XmlDocument();//返回报文
            try
            {
                XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);
                doc.AppendChild(dec);
                XmlElement rootRet = doc.CreateElement("NewDataSet");
                if (ldt.Rows.Count != 0)
                {
                    for (int i = 0; i < ldt.Rows.Count; i++)
                    {
                        XmlNode putawayNodes = doc.CreateElement("Allocation_return");//返回用户节点
                        XmlElement lxMessageType = doc.CreateElement("MessageType");
                        //XmlElement lxeslottable01 = doc.CreateElement("lottable01");
                        //XmlElement lxeslottable02 = doc.CreateElement("lottable02");
                        //XmlElement lxesku = doc.CreateElement("sku");
                        //XmlElement lxeqty = doc.CreateElement("qty");
                        XmlElement lxeMasrerlabel = doc.CreateElement("master_label");
                        XmlElement lxereturn_status = doc.CreateElement("return_status");
                        lxMessageType.InnerText = "AllocationKey";
                        lxeMasrerlabel.InnerText = ldt.Rows[i]["lottable02"].ToString() + '|' + ldt.Rows[i]["sku"].ToString() + '|' + ldt.Rows[i]["lottable01"].ToString() + '|' + ldt.Rows[i]["qty"].ToString();
                        //lxeslottable01.InnerText = ldt.Rows[i]["lottable01"].ToString();
                        //lxeslottable02.InnerText = ldt.Rows[i]["lottable02"].ToString();
                        //lxesku.InnerText = ldt.Rows[i]["sku"].ToString();
                        //lxeqty.InnerText = ldt.Rows[i]["qty"].ToString();
                        lxereturn_status.InnerText = "OK";
                        putawayNodes.AppendChild(lxMessageType);
                        //putawayNodes.AppendChild(lxeslottable01);
                        //putawayNodes.AppendChild(lxeslottable02);
                        //putawayNodes.AppendChild(lxesku);
                        //putawayNodes.AppendChild(lxeqty);
                        putawayNodes.AppendChild(lxeMasrerlabel);
                        putawayNodes.AppendChild(lxereturn_status);
                        rootRet.AppendChild(putawayNodes);
                    }
                }
                else
                {

                    XmlNode putawayNodes = doc.CreateElement("Allocation_return");//返回用户节点
                    XmlElement lxMessageType = doc.CreateElement("MessageType");
                    //XmlElement lxeslottable01 = doc.CreateElement("lottable01");
                    //XmlElement lxeslottable02 = doc.CreateElement("lottable02");
                    //XmlElement lxesku = doc.CreateElement("sku");
                    //XmlElement lxeqty = doc.CreateElement("qty");
                    XmlElement lxeMasrerlabel = doc.CreateElement("master_label");
                    XmlElement lxereturn_status = doc.CreateElement("return_status");
                    lxMessageType.InnerText = "AllocationKey";
                    // lxeMasrerlabel.InnerText = ldt.Rows[i]["lottable02"].ToString() + '|' + ldt.Rows[i]["sku"].ToString() + '|' + ldt.Rows[i]["lottable01"].ToString() + '|' + ldt.Rows[i]["qty"].ToString();
                    lxeMasrerlabel.InnerText = "";
                    //lxeslottable01.InnerText = ldt.Rows[i]["lottable01"].ToString();
                    //lxeslottable02.InnerText = ldt.Rows[i]["lottable02"].ToString();
                    //lxesku.InnerText = ldt.Rows[i]["sku"].ToString();
                    //lxeqty.InnerText = ldt.Rows[i]["qty"].ToString();
                    lxereturn_status.InnerText = "获取调拨信息失败!可能原因： 1、扫描的托盘号错误  2、扫描的调拨单号与托盘号不符,3、扫描的调拨单在系统中不存在";
                    putawayNodes.AppendChild(lxMessageType);
                    //putawayNodes.AppendChild(lxeslottable01);
                    //putawayNodes.AppendChild(lxeslottable02);
                    //putawayNodes.AppendChild(lxesku);
                    //putawayNodes.AppendChild(lxeqty);
                    putawayNodes.AppendChild(lxeMasrerlabel);
                    putawayNodes.AppendChild(lxereturn_status);
                    rootRet.AppendChild(putawayNodes);


                }

                doc.AppendChild(rootRet);
                return doc.InnerXml;
            }

            catch (Exception ex)
            {
                App.Log("PDAXmlAllocationReceipt.cs-11.0", ex.Message.ToString());
                return doc.InnerXml;
            }

        }

        /// <summary>
        /// 11.2库位（校验、库存是否存在,返回信息）
        /// DataSource:Orders
        /// </summary>
        public static string GetAllocationLoc(string xml)
        {
            List<string> sqllists = new List<string>();
            string strSql = string.Empty;
            App.Connection();
            App.DBconSet();

            //1接收调拨单XML(判断是否存在该笔调拨单)

            //  DataTable ldt = LicPdaService.App.Xml3DataTable(xml);
            DataTable ldts = LicPdaService.App.Xml2DataTable(xml);//取调拨单号
            if (ldts.Rows.Count == 0)
            {
                return "";
            }

            DataTable ldt = LicPdaService.App.Xml3DataTable(xml);//取调拨单号
            if (ldt.Rows.Count == 0)
            {
                return "";
            }
            try
            {

                strSql = "select  * from location  where 1=1  and whseid='" + ldts.Rows[0]["whseid"].ToString() + "'    and loc='" + ldt.Rows[0]["loc"].ToString() + "'  ";
                strSql += " and status='OK' ";
                DataTable dtAlt = App.GetDataTable(App.DBconWMS, strSql, "location");//库位是否存在
                if (dtAlt.Rows.Count == 0)
                {
                   // return Allocation_Return(dtAlt);
                }
                return Allocation_Return(dtAlt);
            }
            catch (Exception ex)
            {
                #region
                App.Log("PDAXmlAllocationReceipt.cs-11.2", ex.Message.ToString());
                throw;
                #endregion
            }
        }

        //  库位--是否存在系统中
        private static string AllocationLoc_Return(DataTable ldt)
        {
            XmlDocument doc = new XmlDocument();//返回报文
            try
            {
                // string return_status = "";
                XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);
                doc.AppendChild(dec);
                XmlElement rootRet = doc.CreateElement("NewDataSet");
                if (ldt.Rows.Count != 0)
                {
                    for (int i = 0; i < ldt.Rows.Count; i++)
                    {
                        XmlNode putawayNodes = doc.CreateElement("AllocationLoc_return");//返回用户节点
                        XmlElement lxMessageType = doc.CreateElement("MessageType");
                        XmlElement lxereturn_status = doc.CreateElement("return_status");
                        lxMessageType.InnerText = "AllocationLoc";
                        lxereturn_status.InnerText = "OK";
                        putawayNodes.AppendChild(lxMessageType);
                        putawayNodes.AppendChild(lxereturn_status);
                        rootRet.AppendChild(putawayNodes);
                    }
                }
                else
                {
                    XmlNode putawayNodes = doc.CreateElement("AllocationLoc_return");//返回用户节点
                    XmlElement lxMessageType = doc.CreateElement("MessageType");
                    XmlElement lxereturn_status = doc.CreateElement("return_status");
                    lxMessageType.InnerText = "AllocationLoc";
                    lxereturn_status.InnerText = "库位不存在,请查看扫描的库位是否存在对应厂别中";
                    putawayNodes.AppendChild(lxMessageType);
                    putawayNodes.AppendChild(lxereturn_status);
                    rootRet.AppendChild(putawayNodes);

                }
                doc.AppendChild(rootRet);
                return doc.InnerXml;
            }
            catch (Exception ex)
            {
                App.Log("PDAXmlAllocationReceipt.cs-11.2", ex.Message.ToString());
                return doc.InnerXml;
            }

        }


        /// <summary>
        /// 11.1(根据调拨单--扫描调拨单、托盘号入库)
        /// DataSource:Orders
        /// </summary>
        public static string AllocationReceipt(string xml)
        {
            string whseid = "";
            string userid = "";
            //string orderkey = "";
            //string pickupkey = "";
            //string picktray = "";
            try
            {


                List<string> sqllists = new List<string>();
                string strSql = string.Empty;
                App.Connection();
                App.DBconSet();

                //1接收分拣信息XML

                DataTable ldts = LicPdaService.App.Xml2DataTable(xml);//取扫描调拨类型
                if (ldts.Rows.Count == 0)
                {
                    return AllocationReceipt_Return(ldts);
                   // return "";
                }


                DataTable ldt = LicPdaService.App.Xml3DataTable(xml);//取扫描调拨信息
                if (ldt.Rows.Count == 0)
                {
                   // return "";
                   return AllocationReceipt_Return(ldt);
                }

                bool flag = false;


                 DateTime date_now = DateTime.Now;
                string sql_Date = " select   CONVERT(varchar(100), GETDATE(), 120) as date";
              DataTable date =  App.GetDataTable(App.DBconWMS, sql_Date, "InvAllocation");//校验调拨单是否存在
                if (date.Rows.Count != 0)
                {
                    date_now = DateTime.Parse(date.Rows[0]["date"].ToString());
                }


                for (int i = 0; i < ldt.Rows.Count; i++)
                {
                    strSql = @" select * from  InvAllocation"; //根据调拨单、托盘号查询调拨信息
                    strSql += " where whseid='" + ldts.Rows[0]["whseid"].ToString() + "' and  allocationkey='" + ldts.Rows[0]["allocationkey"].ToString() + "' ";
                    DataTable dtAllocation = App.GetDataTable(App.DBconWMS, strSql, "InvAllocation");//校验调拨单是否存在
                    if (dtAllocation.Rows.Count == 0)
                    {
                        return AllocationReceipt_Return(dtAllocation);
                    } 
                    strSql = @" SELECT Location.whseid,Location.loc,Location.zone_code FROM Location    "; //根据调拨单、托盘号查询调拨信息
                    strSql += "  LEFT JOIN ZONE ON  Zone.whseid=Location.whseid and  ZONE.zone_code=Location.zone_code ";
                    strSql += " where  Location.whseid='" + ldts.Rows[0]["whseid"].ToString() + "' and  Location.loc='" + ldt.Rows[i]["loc"].ToString() + "' ";
                    strSql += " and Location.zone_code='KS-MATERIAL' ";
                    DataTable dtloc = App.GetDataTable(App.DBconWMS, strSql, "location");//检验库位是否存在
                    if (dtloc.Rows.Count == 0)
                    {
                        return AllocationReceipt_Return(dtloc);
                    }


                    string line_no = "";
                    int rowNo = 1;
                    strSql = @" select InvAllocationDetail.whseid,InvAllocationDetail.allocationkey,InvAllocationDetail.line_no,"; //根据调拨单、托盘号查询调拨信息
                    strSql += "InvAllocationDetail.traykey,InvAllocationDetail.customer_code,InvAllocationDetail.sku,";
                    strSql += " InvAllocationDetail.qty,InvAllocationDetail.lottable01,InvAllocationDetail.lottable02,InvAllocationDetail.lottable10,";
                    strSql += " InvAllocationDetail.adddate,InvAllocationDetail.addwho from InvAllocationDetail  ";
                    strSql += " where whseid='"+ ldts.Rows[0]["whseid"].ToString() + "' and  allocationkey='"+ ldts.Rows[0]["allocationkey"].ToString() + "'";
                    strSql += "  and traykey='" + ldt.Rows[i]["traykey"].ToString() + "' and  InvAllocationDetail.status='0' ";
                    DataTable dtAl = App.GetDataTable(App.DBconWMS, strSql, "InvAllocationDetail");
                    if (dtAl.Rows.Count != 0)
                    {
                        for (int j = 0; j < dtAl.Rows.Count; j++)
                        {
                            line_no = rowNo.ToString().PadLeft(5, '0');
                            whseid = ldts.Rows[0]["whseid"].ToString();//厂别
                            userid = ldts.Rows[0]["userid"].ToString();//用户名
                            //orderkey = ldts.Rows[0]["orderkey"].ToString();//出库单号
                            //string customer_code = ldt.Rows[i]["customer_code"].ToString();//厂别(客户)
                            string customer_code = "";
                            if (whseid == "wh1")
                            {
                                customer_code = "KS";//厂别(客户)
                            }
                            if (whseid == "wh2")
                            {
                                customer_code = "KSND";//厂别(客户)
                            }
                            if (whseid == "wh3")
                            {
                                customer_code = "KSJC";//厂别(客户)
                            }
                            string sku = dtAl.Rows[j]["sku"].ToString();//料号
                            string strStr = "select description,unit,packey from sku  where whseid='" + whseid + "' and customer_code='" + customer_code + "' and    sku='" + sku + "'";
                            DataTable dts = App.GetDataTable(App.DBconWMS, strStr, "lotTray");
                            string skudescr = dts.Rows[0]["description"].ToString().Trim();//料号描述
                            string uom = dts.Rows[0]["unit"].ToString().Trim();
                            string packey = dts.Rows[0]["packey"].ToString().Trim();
                            // string skudescr = ldt.Rows[i]["skudescr"].ToString();//料号
                            // string uom = ldt.Rows[i]["uom"].ToString();//单位
                            double qty = double.Parse(dtAl.Rows[j]["qty"].ToString());//数量
                            string lottable01 = dtAl.Rows[j]["lottable01"].ToString();//批次
                            string lottable02 = dtAl.Rows[j]["lottable02"].ToString();//订单号
                            string lottable03 = ldts.Rows[0]["allocationkey"].ToString() + line_no;//调拨单+行号
                            string lottable10 = dtAl.Rows[j]["lottable10"].ToString();//供应商代码
                            string toloc = ldt.Rows[0]["loc"].ToString();
                            string lot = "";
                            string lpn = "";
                            strSql = "DECLARE @key varchar(50) exec pro_GetLot '" + whseid + "','lot','批号',@key OUTPUT select @key as lot "; //调用存储过程pro_GetLot生成托盘号;
                            DataTable dtlot = App.GetDataTable(App.DBconWMS, strSql, "lotTray");
                            if (dtlot.Rows.Count > 0)
                            {
                                lot = dtlot.Rows[0]["lot"].ToString();
                            }

                            strSql = "DECLARE @key varchar(50) exec pro_GetLpn '" + whseid + "','PLT','托盘号',@key OUTPUT select @key as lpn"; //调用存储过程pro_GetLot生成托盘号;
                            DataTable dtlpn = App.GetDataTable(App.DBconWMS, strSql, "lotTray");
                            if (dtlpn.Rows.Count > 0)
                            {
                                lpn = dtlpn.Rows[0]["lpn"].ToString();
                            }
                            strSql = "insert into Inventory(whseid,customer_code,sku,skudescr,loc,lot,lpn,status,qty,uom,tray) values ";
                            strSql += "('" + whseid + "','" + customer_code + "','" + sku + "','" + skudescr + "','" + toloc + "'";
                            strSql += ",'" + lot + "','" + lpn + "','OK'," + qty + ",'" + uom + "','" + ldt.Rows[i]["traykey"].ToString() + "')";
                            sqllists.Add(strSql); //库存表


                            strSql = "insert into LotAttribute(whseid,customer_code,sku,skudescr,lot,lottable01,lottable02,lottable03,lottable04,lottable05,lottable06,lottable07,lottable08,lottable09,lottable10,product,rectype,addwho,adddate) values ";
                            strSql += "('" + whseid + "','" + customer_code + "','" + sku + "','" + skudescr + "','" + lot + "','" + lottable01 + "'";
                            strSql += ",'" + lottable02 + "','" + lottable03 + "','" + date_now + "','" + date_now + "',''";
                            strSql += ",'','','" + packey + "','" + lottable10 + "','0','02','" + userid + "','" + date_now + "')";
                            sqllists.Add(strSql);//库存属性表

                            strSql = " update  InvAllocationDetail set status='1',loc='" + toloc + "',editwho='" + userid + "',editdate='" + date_now + "' where  whseid='" + whseid + "' and allocationkey='" + ldts.Rows[0]["allocationkey"].ToString() + "' and traykey='" + ldt.Rows[i]["traykey"].ToString() + "'   ";
                            sqllists.Add(strSql);//更新调拨明细表（状态）
                            //strSql = " update  InvAllocation  set status='1',editwho='" + userid + "',editdate='" + date_now + "' where  whseid='" + whseid + "' and allocationkey='" + ldts.Rows[0]["allocationkey"].ToString() + "'    ";
                            //sqllists.Add(strSql);//更新调拨明细表（状态）
                            rowNo++;
                        }
                    }

                   
                }
                if (App.ExecuteSQLScriptLists(sqllists, App.DBconWMS))
                {
                    flag = true;
                    sqllists.Clear();
                    List<string> sqllistALL = new List<string>();
                    string strSqlAc = "";

                    string strsqlAll = "  select whseid, allocationkey from InvAllocationDetail  where whseid='" + ldts.Rows[0]["whseid"].ToString() + "' and   allocationkey='" + ldts.Rows[0]["allocationkey"].ToString() + "' and status=0 ";
                    DataTable dts = App.GetDataTable(App.DBconWMS, strsqlAll, "InvAllocationDetail");//校验调拨单是否存在
                    if (dts.Rows.Count == 0)
                    {
                        strSqlAc = " update  InvAllocation set status='1' where whseid='"+ ldts.Rows[0]["whseid"].ToString() + "' and  allocationkey='"+ ldts.Rows[0]["allocationkey"].ToString() + "' ";
                        sqllistALL.Add(strSqlAc);//库存属性表
                        App.ExecuteSQLScriptLists(sqllistALL, App.DBconWMS);
                    }

                }
                return AllocationReceipt_Return(ldt);

            }
            catch (Exception ex)
            {
                #region
                App.Log("PDAXmlAllocationReceipt.cs-11.4", ex.Message.ToString());
                throw;
                #endregion
            }


        }

        //  调拨单--入库是否成功
        private static string AllocationReceipt_Return(DataTable ldt)
        {
            XmlDocument doc = new XmlDocument();//返回报文
            try
            {
                // string return_status = "";
                XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);
                doc.AppendChild(dec);
                XmlElement rootRet = doc.CreateElement("NewDataSet");
                if (ldt.Rows.Count != 0)
                {
                    for (int i = 0; i < ldt.Rows.Count; i++)
                    {
                        XmlNode putawayNodes = doc.CreateElement("Allocation_return");//返回用户节点
                        XmlElement lxMessageType = doc.CreateElement("MessageType");
                        XmlElement lxereturn_status = doc.CreateElement("return_status");
                        lxMessageType.InnerText = "AllocationReceipt";
                        lxereturn_status.InnerText = "OK";
                        putawayNodes.AppendChild(lxMessageType);
                        putawayNodes.AppendChild(lxereturn_status);
                        rootRet.AppendChild(putawayNodes);
                    }
                }
                else
                {
                    XmlNode putawayNodes = doc.CreateElement("Allocation_return");//返回用户节点
                    XmlElement lxMessageType = doc.CreateElement("MessageType");
                    XmlElement lxereturn_status = doc.CreateElement("return_status");
                    lxMessageType.InnerText = "AllocationReceipt";
                    lxereturn_status.InnerText = "1、调拨单号不存在,2、库位不存在或者扫描的库存不是k1原料区、3、入库失败,网络不稳定、卡枪";
                    putawayNodes.AppendChild(lxMessageType);
                    putawayNodes.AppendChild(lxereturn_status);
                    rootRet.AppendChild(putawayNodes);

                }
                doc.AppendChild(rootRet);
                return doc.InnerXml;
            }
            catch (Exception ex)
            {
                App.Log("PDAXmlAllocationReceipt.cs-11.5", ex.Message.ToString());
                return doc.InnerXml;
            }

        }




    }
}
